package data.render;

import java.awt.Color;
import java.util.ArrayList;
import java.util.List;

import data.complex.Ray;
import data.complex.Triangle;
import data.complex.VoxelSpace;
import data.hierarchy.Mesh;
import data.hierarchy.TriangleGroup;
import data.hierarchy.World;



public class ProfileRenderMethod implements IRenderMethod{
  private World world;
  private List<Triangle> triangleCache;
  
  public ProfileRenderMethod(World world){
    this.world = world;
    refresh();
  }
  
  public void refresh(){
    triangleCache = new ArrayList<Triangle>();
    for(Mesh m : world.getMeshes())
      for(TriangleGroup tg : m)
        for(Triangle t : tg)
          triangleCache.add(t);
  }

  @Override
  public Color getPixel(Ray ray) {
    ray.calculateFirstTriangleIntersection(triangleCache);
    if(ray.getIntersection().isIntersecting())
      return Color.WHITE;
    return Color.DARK_GRAY;
  }
  
  public VoxelSpace getVoxelSpace(){
    return null;
  }
}
